package com.manor.main.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.manor.main.R;
import com.manor.main.bean.MainCardBeans;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * 首页滑动卡片处理
 */
public class MainCardsAdapter extends BaseQuickAdapter<MainCardBeans, BaseViewHolder> {
    public MainCardsAdapter(int layoutResId, @Nullable List<MainCardBeans> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, MainCardBeans item) {
        ImageView ivImg = helper.getView(R.id.card_img);
        helper.setText(R.id.tv_name, item.getName()).setText(R.id.tv_sign, item.getSignature());
        addChildClickViewIds(R.id.card_img);
        Glide.with(getContext()).load(item.getAvatar()).into(ivImg);
    }
}
